package com.liner.homework.third;


public class RefArrayDemo {
    public static void main(String[] args) {
        Dog[] dogs = new Dog[3];
        Chick[] chicks = new Chick[3];
        Fish[] fish = new Fish[2];

        dogs[0] = new Dog("边牧", 13, "brown");
        dogs[1] = new Dog("二哈", 12, "white");
        dogs[2] = new Dog("大黑", 11, "black");

        fish[0] = new Fish("章鱼", 31, "blue");
        fish[1] = new Fish("鲸鱼", 42, "dark blue");

        chicks[0] = new Chick("小康", 4, "red");
        chicks[1] = new Chick("小鸡", 6, "pink");
        chicks[2] = new Chick("小王", 5, "yellow");


        for (Dog dog : dogs) {
            System.out.println(dog.getName() + " " + dog.getAge() + " " + dog.getColor());
            dog.eat();
            dog.drink();
            dog.lookHome();
        }

        for (Chick chick : chicks) {
            System.out.println(chick.getName() + " " + chick.getAge() + " " + chick.getColor());
            chick.eat();
            chick.drink();
            chick.layEggs();
        }

        for (Fish fish1 : fish) {
            System.out.println(fish1.getName() + " " + fish1.getAge() + " " + fish1.getColor());
            fish1.eat();
            fish1.drink();
            fish1.swim();
        }


    }
}
